
CREATE TRIGGER passwordLen ON Users AFTER INSERT
AS
BEGIN
	IF((SELECT LEN(passwrd) from inserted)<6)
	BEGIN
		RAISERROR('Haslo musi miec przynajmniej 6 znakow!', 1, 1)
		ROLLBACK TRANSACTION
	END
END
GO

CREATE TRIGGER passwordUpd ON Users AFTER UPDATE
AS
BEGIN
	IF((SELECT LEN(passwrd) from inserted)<6)
	BEGIN
		RAISERROR('Haslo musi miec przynajmniej 6 znakow!', 1, 1)
		ROLLBACK TRANSACTION
	END
END
GO

CREATE TRIGGER loginLen ON Users AFTER INSERT
AS
BEGIN
	IF((SELECT LEN(userlogin) from inserted)<4)
	BEGIN
		RAISERROR('Login musi miec przynajmniej 4 znaki!', 1, 1)
		ROLLBACK TRANSACTION
	END
END
GO

